<!--
 * @Author: Bobby
 * @Date: 2021-12-30 10:01:42
 * @LastEditTime: 2022-02-16 17:39:25
 * @LastEditors: Bobby
 * @Description:
 * @FilePath: \wms-v2\src\project\bobby\views\index.vue
 * CIMC-V2
-->
<template>
  <div class="index-container">
    <button class="rounded-sm bg-gray-500 p-1" @click="addDom">生成dom(普通创建)</button>
    <!-- <div v-for="(item, i) in jsonData" :key="i" class="bg-gray-50 mt-2">
      <el-switch v-model="index" />
      <button>Socket1{{ item.name }}</button>
      <el-tag class="ml-2" type="success">Tag 2</el-tag>
      <el-tag class="ml-2" type="info">Tag 3</el-tag>
      <el-tag class="ml-2" type="warning">Tag 4</el-tag>
      <el-tag class="ml-2" type="danger">Tag 5</el-tag>
    </div> -->
  </div>
</template>

<script>
  import { defineComponent, h, ref, onUpdated } from 'vue'
  import Dbutton from './button'
  export default defineComponent({
    name: 'Index',
    setup() {
      const arr = ref([])

      onUpdated(() => {
        console.log('更新完成')
        console.timeEnd('测试时间')
      })
      return () => {
        return h('div', null, [
          h(
            'button',
            {
              onClick: () => {
                console.log('测试')
                for (let i = 0; i <= 1000; i++) {
                  arr.value.push({
                    name: `组件${i}`,
                  })
                }
                console.time('测试时间')
              },
            },
            '创建dom'
          ),
          arr.value.map((item) => {
            return h('div', null, [h(Dbutton, {}, item.name)])
          }),
        ])
      }
    },
  })
</script>

<style lang="scss" scoped></style>
